class Solution:
    def newInteger(self, n: int) -> int:
        bit = 0
        while pow(9, bit + 1) <= n:
            bit += 1

        ans = []
        for b in range(bit, -1, -1):
            now = pow(9, b)
            ans.append(n // now)
            n %= now

        return int("".join(str(ch) for ch in ans))


if __name__ == "__main__":
    print(Solution().newInteger(9))  # 10
